<template>
  <div>
    <div ref="div1">{{msg}}</div>
    <div>{{msg2}}</div>
    <button @click="clickBtn()">点我</button>
  </div>
</template>

<script>
    export default {
        name: "test",
      data(){
          return {
            msg:"hello vue",
            msg2:""
          }
      },
      methods:{
          clickBtn(){
            this.msg="hello world";
            this.$nextTick(() => {//等页面渲染后，再做的处理。
              this.msg2=this.$refs.div1.innerHTML;
            })
          }
      }
    }
</script>

<style scoped>

</style>
